package com.itheima;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;

public class Demo5 {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();

        list.add("王佳乐");
        list.add("张三丰");
        list.add("王思聪");
        list.add("张飞");
        list.add("刘晓敏");
        list.add("张靓颖");
        list.add("张靓颖");
        list.add("王敏");

        Stream<String> stream1 = list.stream().filter(s -> s.startsWith("张"));
        Stream<String> stream2 = list.stream().filter(s -> s.startsWith("王"));
        Stream<String> concat = Stream.concat(stream1, stream2);
        concat.forEach(s -> System.out.println(s));
    }
}
